<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkSearchEntry: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="NumericEntry.html" title="Numeric and Text Data Entry">
<link rel="prev" href="GtkSpinButton.html" title="GtkSpinButton">
<link rel="next" href="GtkSearchBar.html" title="GtkSearchBar">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GtkSearchEntry.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GtkSearchEntry.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                  <a href="#GtkSearchEntry.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_signals">  <span class="dim">|</span> 
                  <a href="#GtkSearchEntry.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="NumericEntry.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GtkSpinButton.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GtkSearchBar.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GtkSearchEntry"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GtkSearchEntry.top_of_page"></a>GtkSearchEntry</span></h2>
<p>GtkSearchEntry — An entry which shows a search icon</p>
</td>
<td class="gallery_image" valign="top" align="right"><img src="search-entry.png"></td>
</tr></table></div>
<div class="refsect1">
<a name="GtkSearchEntry.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkSearchEntry.html#gtk-search-entry-new" title="gtk_search_entry_new ()">gtk_search_entry_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkSearchEntry.html#gtk-search-entry-handle-event" title="gtk_search_entry_handle_event ()">gtk_search_entry_handle_event</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signal_proto_type">
<col width="300px" class="signal_proto_name">
<col width="200px" class="signal_proto_flags">
</colgroup>
<tbody>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkSearchEntry.html#GtkSearchEntry-next-match" title="The “next-match” signal">next-match</a></td>
<td class="signal_flags">Action</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkSearchEntry.html#GtkSearchEntry-previous-match" title="The “previous-match” signal">previous-match</a></td>
<td class="signal_flags">Action</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkSearchEntry.html#GtkSearchEntry-search-changed" title="The “search-changed” signal">search-changed</a></td>
<td class="signal_flags">Run Last</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkSearchEntry.html#GtkSearchEntry-stop-search" title="The “stop-search” signal">stop-search</a></td>
<td class="signal_flags">Action</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GtkSearchEntry.html#GtkSearchEntry-struct" title="struct GtkSearchEntry">GtkSearchEntry</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> GInitiallyUnowned
        <span class="lineart">╰──</span> <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
            <span class="lineart">╰──</span> <a class="link" href="GtkEntry.html" title="GtkEntry">GtkEntry</a>
                <span class="lineart">╰──</span> GtkSearchEntry
</pre>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GtkSearchEntry implements
 AtkImplementorIface,  <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>,  <a class="link" href="GtkEditable.html" title="GtkEditable">GtkEditable</a> and  <a class="link" href="GtkCellEditable.html" title="GtkCellEditable">GtkCellEditable</a>.</p>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gtk/gtk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.description"></a><h2>Description</h2>
<p><a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> is a subclass of <a class="link" href="GtkEntry.html" title="GtkEntry"><span class="type">GtkEntry</span></a> that has been
tailored for use as a search entry.</p>
<p>It will show an inactive symbolic “find” icon when the search
entry is empty, and a symbolic “clear” icon when there is text.
Clicking on the “clear” icon will empty the search entry.</p>
<p>Note that the search/clear icon is shown using a secondary
icon, and thus does not work if you are using the secondary
icon position for some other purpose.</p>
<p>To make filtering appear more reactive, it is a good idea to
not react to every change in the entry text immediately, but
only after a short delay. To support this, <a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a>
emits the <a class="link" href="GtkSearchEntry.html#GtkSearchEntry-search-changed" title="The “search-changed” signal"><span class="type">“search-changed”</span></a> signal which can
be used instead of the <a class="link" href="GtkEditable.html#GtkEditable-changed" title="The “changed” signal"><span class="type">“changed”</span></a> signal.</p>
<p>The <a class="link" href="GtkSearchEntry.html#GtkSearchEntry-previous-match" title="The “previous-match” signal"><span class="type">“previous-match”</span></a>, <a class="link" href="GtkSearchEntry.html#GtkSearchEntry-next-match" title="The “next-match” signal"><span class="type">“next-match”</span></a>
and <a class="link" href="GtkSearchEntry.html#GtkSearchEntry-stop-search" title="The “stop-search” signal"><span class="type">“stop-search”</span></a> signals can be used to implement
moving between search results and ending the search.</p>
<p>Often, GtkSearchEntry will be fed events by means of being
placed inside a <a class="link" href="GtkSearchBar.html" title="GtkSearchBar"><span class="type">GtkSearchBar</span></a>. If that is not the case,
you can use <a class="link" href="GtkSearchEntry.html#gtk-search-entry-handle-event" title="gtk_search_entry_handle_event ()"><code class="function">gtk_search_entry_handle_event()</code></a> to pass events.</p>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gtk-search-entry-new"></a><h3>gtk_search_entry_new ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_search_entry_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a <a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a>, with a find icon when the search field is
empty, and a clear icon when it isn't.</p>
<div class="refsect3">
<a name="gtk-search-entry-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-6.html#api-index-3.6">3.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-search-entry-handle-event"></a><h3>gtk_search_entry_handle_event ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_search_entry_handle_event (<em class="parameter"><code><a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> *entry</code></em>,
                               <em class="parameter"><code><span class="type">GdkEvent</span> *event</code></em>);</pre>
<p>This function should be called when the top-level window
which contains the search entry received a key event. If
the entry is part of a <a class="link" href="GtkSearchBar.html" title="GtkSearchBar"><span class="type">GtkSearchBar</span></a>, it is preferable
to call <a class="link" href="GtkSearchBar.html#gtk-search-bar-handle-event" title="gtk_search_bar_handle_event ()"><code class="function">gtk_search_bar_handle_event()</code></a> instead, which will
reveal the entry in addition to passing the event to this
function.</p>
<p>If the key event is handled by the search entry and starts
or continues a search, <code class="literal">GDK_EVENT_STOP</code> will be returned.
The caller should ensure that the entry is shown in this
case, and not propagate the event further.</p>
<div class="refsect3">
<a name="gtk-search-entry-handle-event.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>entry</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>event</p></td>
<td class="parameter_description"><p>a key event</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-search-entry-handle-event.returns"></a><h4>Returns</h4>
<p> <code class="literal">GDK_EVENT_STOP</code> if the key press event resulted
in a search beginning or continuing, <code class="literal">GDK_EVENT_PROPAGATE</code>
otherwise.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GtkSearchEntry-struct"></a><h3>struct GtkSearchEntry</h3>
<pre class="programlisting">struct GtkSearchEntry;</pre>
</div>
</div>
<div class="refsect1">
<a name="GtkSearchEntry.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GtkSearchEntry-next-match"></a><h3>The <code class="literal">“next-match”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> *entry,
               <span class="type">gpointer</span>        user_data)</pre>
<p>The ::next-match signal is a <a class="link" href="gtk3-Bindings.html#GtkBindingSignal" title="struct GtkBindingSignal">keybinding signal</a>
which gets emitted when the user initiates a move to the next match
for the current search string.</p>
<p>Applications should connect to it, to implement moving between
matches.</p>
<p>The default bindings for this signal is Ctrl-g.</p>
<div class="refsect3">
<a name="GtkSearchEntry-next-match.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>entry</p></td>
<td class="parameter_description"><p>the entry on which the signal was emitted</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Action</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkSearchEntry-previous-match"></a><h3>The <code class="literal">“previous-match”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> *entry,
               <span class="type">gpointer</span>        user_data)</pre>
<p>The ::previous-match signal is a <a class="link" href="gtk3-Bindings.html#GtkBindingSignal" title="struct GtkBindingSignal">keybinding signal</a>
which gets emitted when the user initiates a move to the previous match
for the current search string.</p>
<p>Applications should connect to it, to implement moving between
matches.</p>
<p>The default bindings for this signal is Ctrl-Shift-g.</p>
<div class="refsect3">
<a name="GtkSearchEntry-previous-match.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>entry</p></td>
<td class="parameter_description"><p>the entry on which the signal was emitted</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Action</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkSearchEntry-search-changed"></a><h3>The <code class="literal">“search-changed”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> *entry,
               <span class="type">gpointer</span>        user_data)</pre>
<p>The <a class="link" href="GtkSearchEntry.html#GtkSearchEntry-search-changed" title="The “search-changed” signal"><span class="type">“search-changed”</span></a> signal is emitted with a short
delay of 150 milliseconds after the last change to the entry text.</p>
<div class="refsect3">
<a name="GtkSearchEntry-search-changed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>entry</p></td>
<td class="parameter_description"><p>the entry on which the signal was emitted</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Run Last</p>
<p class="since">Since: <a class="link" href="api-index-3-10.html#api-index-3.10">3.10</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkSearchEntry-stop-search"></a><h3>The <code class="literal">“stop-search”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkSearchEntry.html" title="GtkSearchEntry"><span class="type">GtkSearchEntry</span></a> *entry,
               <span class="type">gpointer</span>        user_data)</pre>
<p>The ::stop-search signal is a <a class="link" href="gtk3-Bindings.html#GtkBindingSignal" title="struct GtkBindingSignal">keybinding signal</a>
which gets emitted when the user stops a search via keyboard input.</p>
<p>Applications should connect to it, to implement hiding the search
entry in this case.</p>
<p>The default bindings for this signal is Escape.</p>
<div class="refsect3">
<a name="GtkSearchEntry-stop-search.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>entry</p></td>
<td class="parameter_description"><p>the entry on which the signal was emitted</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Action</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>